#include <iostream>

using namespace std;

//string字符存取
//string中单个字符存取方式有两种
//1、char& operator[](int n);      //通过[]方式取字符
//2、char& at(int n);              //通过at方法获取字符
void test() {
    string s = "hello";
    for (int i = 0; i < s.size(); ++i) {
        cout << s[i] << " ";
    }
    cout << endl;
    for (int i = 0; i < s.size(); ++i) {
        cout << s.at(i) << " ";
    }
    cout << endl;
    s[0] = 'H';
    cout << "s:" << s << endl;
}

int main() {
    test();
    return 0;
}